Vercel

Overview

Core concepts, capabilities, and architecture

v0 turns your ideas into real web apps using natural language. Describe what you want and the v0 agent builds it for you with best in class architecture. The v0 API gives you programmatic access to all of v0's capabilities.

What can you build with the Platform API?

With the v0 Platform API, you can create your own experiences around v0's core functionality:

  • Custom chat interfaces - Build your own UI for v0's AI-powered code generation
  • Automated workflows - Trigger code generation, iterate on projects, and deploy automatically
  • Development tools - Integrate v0 into IDEs, CI/CD pipelines, or internal tools
  • Team dashboards - Create custom project management and collaboration interfaces
  • AI agents - Build autonomous systems that use v0 to generate and deploy code
  • Educational platforms - Create coding tutorials and interactive learning experiences

Core Concepts

Chats

Chats are AI-powered conversations that help you develop your projects.

import { v0 } from 'v0-sdk'

// Start a chat with AI generation
const chat = await v0.chats.create({
  message: 'Create a todo app with React and TypeScript',
})

Messages

Messages represent the conversation between users and the AI agent. Each message has a role (user or assistant) and contains parts with the full agent trace including thinking, file operations, and tool calls.

// Send a follow-up message
const response = await v0.messages.send({
  chatId: chat.id,
  message: 'Add dark mode support',
})

Deployments

Deploy your chats to production with built-in hosting:

const deployment = await v0.chats.deploy({
  chatId: chat.id,
})

API Architecture

Base URL

All API requests are made to:

https://api.v0.app

RESTful Design

The API follows REST principles with predictable resource URLs:

GET    https://api.v0.app/v2/chats              # List chats
POST   https://api.v0.app/v2/chats              # Create chat
GET    https://api.v0.app/v2/chats/:id          # Get chat
DELETE https://api.v0.app/v2/chats/:id          # Delete chat

GET    https://api.v0.app/v2/chats/:id/messages # Get messages
POST   https://api.v0.app/v2/chats/:id/messages # Send message

Authentication

All requests require API key authentication. Use createClient() to set the API key.

import { createClient } from 'v0-sdk'

// Add API key
const v0 = createClient({
  apiKey: process.env.V0_API_KEY,
})

Get your API key from v0.app/chat/settings/keys.

Error Handling

Consistent error responses across all endpoints:

{
  "message": "Chat not found"
}

Integration Patterns

1. Direct API Usage

Use the core SDK for full control:

import { v0 } from 'v0-sdk'

// Create and iterate on a chat
const chat = await v0.chats.create({
  message: 'Build a dashboard with charts',
})

// Send follow-up messages
await v0.messages.send({
  chatId: chat.id,
  message: 'Add a dark mode toggle',
})

2. Streaming Responses

Handle real-time streaming for responsive UIs:

const stream = await v0.messages.sendStream({
  chatId: chat.id,
  message: 'Add authentication',
})

for await (const event of stream) {
  switch (event.object) {
    case 'message':
      // Initial or final message snapshot
      console.log(event.parts)
      break
    case 'message.parts.chunk':
      // Incremental content update
      break
    case 'message.usage':
      // Token usage and credits
      console.log(event.usage)
      break
  }
}

3. Webhook Integration

Receive notifications for chat events:

// Register a webhook
await v0.webhooks.create({
  url: 'https://your-app.com/webhooks/v0',
  events: ['chat.message.created', 'chat.deployed'],
})

Security & Privacy

API Security

  • API keys are scoped to your account and can be rotated
  • HTTPS encryption for all API communications
  • Input validation protects against malicious payloads

Data Privacy

  • Your code remains private and is not used for training
  • Data is encrypted at rest and in transit
  • Access logs are maintained for security auditing

Best Practices

  • Store API keys securely using environment variables
  • Rotate keys regularly for enhanced security
  • Monitor usage for unusual activity patterns

Getting Started

1. Get Your API Key

Visit v0.app/chat/settings/keys to generate your API key.

2. Install the SDK

npm install v0-sdk
# or
pnpm add v0-sdk

3. Make Your First Call

import { v0 } from 'v0-sdk'

// List your chats
const chats = await v0.chats.list()
console.log('Your chats:', chats)

4. Explore the Guides

Support & Resources

Documentation

Community

Enterprise

  • Custom integrations for enterprise workflows
  • Dedicated support and priority assistance
  • SLA guarantees and priority support

Contact enterprise@vercel.com for enterprise inquiries.